#pragma once

#include <chrono>
#include <thread>
#include <atomic>
#include <mutex>
#include <condition_variable>

#include "util/fs.h"


namespace logger {

class LogRemover {
public:
	LogRemover(const fs::path &logDir, std::chrono::seconds interval);

	~LogRemover();

private:
	void loop();

	void removeLog();

private:
	const fs::path logDir_;

	const std::chrono::steady_clock::duration interval_;

	std::atomic_bool stopped_{ false };

	std::mutex mtx_;

	std::condition_variable cv_;

	std::thread thread_;
};

}
